package vip.ola.pay.batchpay.sdk.pay;

import vip.ola.pay.batchpay.sdk.pay.domain.cashierPay.CashierRequest;
import vip.ola.pay.batchpay.sdk.pay.domain.cashierPay.CashierResponse;
import vip.ola.pay.batchpay.sdk.pay.domain.nativePay.NativePayRequest;
import vip.ola.pay.batchpay.sdk.pay.domain.nativePay.NativePayResponse;
import vip.ola.pay.batchpay.sdk.pay.domain.paymenQuery.PaymentQueryRequest;
import vip.ola.pay.batchpay.sdk.pay.domain.protocol.ProtocolPayBindCardRequest;
import vip.ola.pay.batchpay.sdk.pay.domain.protocol.ProtocolPayBindCardResponse;
import vip.ola.pay.batchpay.sdk.pay.domain.withdraw.CustomerAccountQueryResp;
import vip.ola.pay.batchpay.sdk.pay.domain.withdraw.WithdrawToCardQueryResponse;
import vip.ola.pay.batchpay.sdk.pay.domain.withdraw.WithdrawToCardRequest;
import vip.ola.pay.batchpay.sdk.pay.domain.withdraw.WithdrawToCardResponse;
import vip.ola.pay.batchpay.sdk.utils.Config;
import vip.ola.pay.batchpay.sdk.utils.RemoteInvoker;

import java.util.Map;



public class PaymentHelper {



    /**
     * 預下單支付/收銀檯支付
     * @param request 订单内容
     * @throws Exception
     */
    public static CashierResponse cashierPay(CashierRequest request) throws Exception{
        return RemoteInvoker.invoke(request, Config.getCashierPayUrl(), CashierResponse.class);
    }

    /**
     * 主掃支付
     * @param request 订单内容
     * @throws Exception
     */
    public static NativePayResponse nativePay(NativePayRequest request) throws Exception{
        return RemoteInvoker.invoke(request, Config.getNativePayUrl(), NativePayResponse.class);
    }


    /**
     * 单笔代付
     * @param request 订单内容
     * @throws Exception
     */
    public static WithdrawToCardResponse withdrawalToCard(WithdrawToCardRequest request) throws Exception{
        return RemoteInvoker.invoke(request, Config.getWithdrawalToCardUrl(), WithdrawToCardResponse.class);
    }
    

    /**
     * 单笔代付查询
     * @param request 订单内容
     * @throws Exception
     */
    public static WithdrawToCardQueryResponse withdrawalToCardQuery(PaymentQueryRequest request) throws Exception{
        return RemoteInvoker.invoke(request, Config.getWithdrawalToCardQueryUrl(), WithdrawToCardQueryResponse.class);
    }
    
    /**
     * 余额查询
     * @param request 订单内容
     * @throws Exception
     */
    public static CustomerAccountQueryResp accountQuery(Map<String, String> request) throws Exception{
        return RemoteInvoker.invoke(request, Config.getAccountQueryUrl(), CustomerAccountQueryResp.class);
    }


    /**
     * 协议支付绑卡预交易
     * @param request 订单内容
     * @throws Exception
     */
    public static ProtocolPayBindCardResponse bindCard(ProtocolPayBindCardRequest request) throws Exception{
        return RemoteInvoker.invoke(request, Config.getBindCardUrl(), ProtocolPayBindCardResponse.class);
    }

    
    
}

